<template>
  <div>
    <h1>我是count</h1>
    <h5>我是count的{{count}}</h5>
    <button @click="add">累加</button>
    <button @click="addN({n:2,m:3})">累加(2+3)</button>
  </div>
</template>

<script>
import { mapMutations } from 'vuex'
export default {
  name: "Count",
  computed:{
    count(){
      return this.$store.state.count.count
    }
  },
  methods:{
    ...mapMutations("count",(["add"])),
    addN({n,m}){
      this.$store.commit("count/addN",{n,m})
    }
  }
};
</script>

<style>
</style>